﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DwarfParser
{
    public enum TokenType : sbyte
    {
        EOF = - 127,
        ERROR = -1,        
        ID = 0,
        INTEGER,
        SEMICOLON, DOT, COMMA,
        ASSIGMENT,
        LEFT_PAREN, RIGHT_PAREN,
        LEFT_BRACE, RIGHT_BRACE,
        LEFT_BRACKET, RIGHT_BRACKET,
        PLUS, MINUS, MULTIPLICATION, DIVISION,
        
        NOT, AND, OR, LT, GT,

        TRUE, FALSE,
        IF, ELSE,
        WHILE,
        CLASS,
        PUBLIC,
        STATIC, MAIN,
        EXTENDS,
        THIS,
        NEW,
        RETURN,

        COMMENT,

        TYPE_DECL,   // INT BOOLEAN VOID STRING INT_ARR STRING_ARR

        AND_BITWISE, OR_BITWISE
    }

    class Token
    {
        public TokenType Type { get; set; }
        public string Attribute { get; set; }

        public Token(TokenType type, string value  = "")
        {
            this.Type = type;
            this.Attribute = value;              
        }

        override public string ToString()
        {
            string optPart = (this.Attribute.Length == 0) ? "" : ", \"" + this.Attribute + "\"";
            return "<" + this.Type + optPart + ">";
        }
    }
}
